#include "StdAfx.h"
#include "Patch.h"
#include "WMVCoreHook.h"
#include "WMPHook.h"

#pragma unmanaged

void* SelectWMVCoreMethod(int num) {
	void* proc = wmvcoreHook[num];
	if (!proc) {
		proc = wmvcoreSave[num];
	}
	return proc;
}

HRESULT WINAPI WMCreateEditorHook(IWMMetadataEditor **ppEditor) {
	SyncFuncHook(HRESULT, PWMCreateEditor, SelectWMVCoreMethod(0), (ppEditor));
}

HRESULT WINAPI WMCheckURLExtensionHook(LPCWSTR pwszURL) {
	SyncFuncHook(HRESULT, PWMCheckURLExtension, SelectWMVCoreMethod(1), (pwszURL));
}

HRESULT WINAPI WMCreateReaderHook(IUnknown* pUnkCert, DWORD dwRights, IWMReader **ppReader) {
	SyncFuncHook(HRESULT, PWMCreateReader, SelectWMVCoreMethod(2), (pUnkCert, dwRights, ppReader));
}

